#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

 // definition for singly-linked list.
  struct listnode {
      int val;
      struct listnode *next;
  };
 
typedef struct ListNode* SL;
struct ListNode* reverseList(struct ListNode* head) {
    SL prev = NULL;
    SL current = head;
    SL next = current->next;
    while (current != NULL && current != NULL)
    {
        current->next = prev;
        prev = current;
        current = next;
        next = current->next;
    }
    return prev;
}